/***
 * @description axios封装
 * @file api.ts
 * @author andy
 * @date 2024/3/22 16:40
 */
// file:api.s
// 1、导入axios以及拦截器
import service from "./request";

// demo接口1
export const demo1 = (data: any) => {
  return service({
    url: "/user/user/demo1/" + data,
    method: "post",
  });
};

// demo接口2
export const demo2 = (data: any) => {
  return service({
    url: "/user/user/demo2",
    method: "post",
    data,
  });
};

// 登录
export const userLogin = (data: any) => {
  return service({
    url: "/user/index/userLogin",
    method: "post",
    data,
  });
};

// 注册
export const userReg = (data: any) => {
  return service({
    url: "/user/index/userReg",
    method: "post",
    data,
  });
};

// 发送验证码
export const sendCode = (mobile: any) => {
  return service({
    url: "/user/index/sendCode/" + mobile,
    method: "post",
  });
};

// 获取菜单
export const getTreeList = () => {
  return service({
    url: "/user/index/getTreeList",
    method: "post",
  });
};

// 获取品牌
export const getBrandList = (data: any) => {
  return service({
    url: "/product/index/getBrandList",
    method: "post",
    data,
  });
};

// 修改状态按Id
export const updateStatusById = (data: any) => {
  return service({
    url: "/product/index/updateStatusById",
    method: "post",
    data,
  });
};

// 添加品牌
export const addBrand = (data: any) => {
  return service({
    url: "/product/index/addBrand",
    method: "post",
    data,
  });
};

// 获取用户按角色id
export const getUserList = (data: any) => {
  return service({
    url: "/user/index/getUserList",
    method: "post",
    data,
  });
};

// 获取类型树形列表
export const getTypeList = (data: any) => {
  return service({
    url: "/product/type/getTypeList",
    method: "post",
    data,
  });
};

// 添加类型
export const addType = (data: any) => {
  return service({
    url: "/product/type/addType",
    method: "post",
    data,
  });
};

// 获取商品
export const getProdList = (data: any) => {
  return service({
    url: "/product/index/getProdList",
    method: "post",
    data,
  });
};

//获取字典表
export const getDictListByTypeId = (typeId: any) => {
  return service({
    url: "/product/index/getDictListByTypeId/" + typeId,
    method: "post",
  });
};

//下拉树形选择
export const getSelectTypeList = () => {
  return service({
    url: "/product/type/getSelectTypeList",
    method: "post",
  });
};

//获取品牌数据
export const getBrandData = () => {
  return service({
    url: "/product/index/getBrandData",
    method: "post",
  });
};

// 添加商品
export const addProd = (data: any) => {
  return service({
    url: "/product/index/addProd",
    method: "post",
    data,
  });
};

// 添加商品附件
export const addProdAtta = (data: any) => {
  return service({
    url: "/product/index/addProdAtta",
    method: "post",
    data,
  });
};

// 批量删除
export const deleteBatchProd = (data: any) => {
  return service({
    url: "/product/index/deleteBatchProd",
    method: "post",
    data,
  });
};

// 按id删除
export const deleteByProdId = (prodId: any) => {
  return service({
    url: "/product/index/deleteByProdId/" + prodId,
    method: "post",
  });
};

// 获取订单列表
export const getOrderList = (data: any) => {
  return service({
    url: "/product/index/getOrderList",
    method: "post",
    data,
  });
};

// 获取商品信息
export const getProdInfo = () => {
  return service({
    url: "/product/index/getProdInfo",
    method: "post",
  });
};

// 添加订单
export const addOrder = (data: any) => {
  return service({
    url: "/product/index/addOrder",
    method: "post",
    data,
  });
};

// 添加订单
export const deleteBatchOrder = (data: any) => {
  return service({
    url: "/product/index/deleteBatchOrder",
    method: "post",
    data,
  });
};

// 添加订单
export const getOrderRecord = () => {
  return service({
    url: "/product/index/getOrderRecord",
    method: "post",
  });
};

// 按商品id获取商品
export const getProdByProdId = (prodId: any) => {
  return service({
    url: "/product/index/getProdByProdId/" + prodId,
    method: "post",
  });
};

// 获取商品信息
export const getProdInfoList = (data: any) => {
  return service({
    url: "/product/index/getProdInfoList",
    method: "post",
    data,
  });
};

// 添加商品信息
export const addProdInfo = (data: any) => {
  return service({
    url: "/product/index/addProdInfo",
    method: "post",
    data,
  });
};
